package com.ruoyi.background.service.impl;

import com.ruoyi.background.domain.AppSiteTopicUserDetail;
import com.ruoyi.background.mapper.AppSiteTopicUserDetailMapper;
import com.ruoyi.background.service.IAppSiteTopicUserDetailService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户答题详情Service业务层处理
 *
 * @author susu
 * @date 2024-08-27
 */
@Service
public class AppSiteTopicUserDetailServiceImpl implements IAppSiteTopicUserDetailService {
    @Autowired
    private AppSiteTopicUserDetailMapper appSiteTopicUserDetailMapper;

    /**
     * 查询用户答题详情
     *
     * @param id 用户答题详情主键
     * @return 用户答题详情
     */
    @Override
    public AppSiteTopicUserDetail selectAppSiteTopicUserDetailById(Long id) {
        return appSiteTopicUserDetailMapper.selectAppSiteTopicUserDetailById(id);
    }

    /**
     * 查询用户答题详情列表
     *
     * @param appSiteTopicUserDetail 用户答题详情
     * @return 用户答题详情
     */
    @Override
    public List<AppSiteTopicUserDetail> selectAppSiteTopicUserDetailList(AppSiteTopicUserDetail appSiteTopicUserDetail) {
        return appSiteTopicUserDetailMapper.selectAppSiteTopicUserDetailList(appSiteTopicUserDetail);
    }

    /**
     * 新增用户答题详情
     *
     * @param appSiteTopicUserDetail 用户答题详情
     * @return 结果
     */
    @Override
    public int insertAppSiteTopicUserDetail(AppSiteTopicUserDetail appSiteTopicUserDetail) {
        appSiteTopicUserDetail.setCreateTime(DateUtils.getNowDate());
        return appSiteTopicUserDetailMapper.insertAppSiteTopicUserDetail(appSiteTopicUserDetail);
    }

    /**
     * 修改用户答题详情
     *
     * @param appSiteTopicUserDetail 用户答题详情
     * @return 结果
     */
    @Override
    public int updateAppSiteTopicUserDetail(AppSiteTopicUserDetail appSiteTopicUserDetail) {
        return appSiteTopicUserDetailMapper.updateAppSiteTopicUserDetail(appSiteTopicUserDetail);
    }

    /**
     * 批量删除用户答题详情
     *
     * @param ids 需要删除的用户答题详情主键
     * @return 结果
     */
    @Override
    public int deleteAppSiteTopicUserDetailByIds(Long[] ids) {
        return appSiteTopicUserDetailMapper.deleteAppSiteTopicUserDetailByIds(ids);
    }

    /**
     * 删除用户答题详情信息
     *
     * @param id 用户答题详情主键
     * @return 结果
     */
    @Override
    public int deleteAppSiteTopicUserDetailById(Long id) {
        return appSiteTopicUserDetailMapper.deleteAppSiteTopicUserDetailById(id);
    }

    /**
     * 批量插入
     *
     * @param detailList 列表
     * @return 结果
     */
    @Override
    public int insertAppSiteTopicUserDetailList(List<AppSiteTopicUserDetail> detailList) {
        return appSiteTopicUserDetailMapper.insertAppSiteTopicUserDetailList(detailList);
    }
}
